package com.myzl.coal.mongo.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.Date;

/**
 * @author Administrator
 */
@Data
@Builder
@Document(collection ="HistoryData")
@Alias("mongoHistoryData")
@AllArgsConstructor
@NoArgsConstructor
public class HistoryData implements Serializable {

    public void initBasic(){
        this.id = null;
        this.createBy = "admin";
        this.createTime = new Date();
        this.updateBy = "admin";
        this.updateTime = new Date();
    }

    private static final long serialVersionUID = 1L;

    /** 主键自增 */
    @Id
    private String id;

    /** 字典属性值 */
    private Integer dictValue;

    /** 设备类型（1PLC 2雷达 3双目 4摄像头） */
    private Integer deviceType;

    /** 设备编号 */
    private Integer deviceId;

    /** 数据值 */
    private String dataValue;

    /** 单位 */
    private String dataUnit;

    /** 创建者 */
    private String createBy;

    /** 创建时间 */
    @JsonFormat(locale = "zh", timezone = "Asia/Shanghai",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    private String updateBy;

    /** 更新时间 */
    @JsonFormat(locale = "zh", timezone = "Asia/Shanghai",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /** 备注 */
    private String remark ="";
    /** 开始时间 */
    @JsonFormat(locale = "zh", timezone = "Asia/Shanghai",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;
    /** 结束时间 */
    @JsonFormat(locale = "zh", timezone = "Asia/Shanghai",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
}
